package com.example.fist.entity;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "winning", schema = "competition", catalog = "")
public class WinningEntity {
    private int wiId;
    private String name;
    private String company;
    private String coName;
    private String grade;
    private String awards;
    private Date winningTime;
    private String trend;

    @Id
    @Column(name = "wi_id", nullable = false)
    public int getWiId() {
        return wiId;
    }

    public void setWiId(int wiId) {
        this.wiId = wiId;
    }

    @Basic
    @Column(name = "name", nullable = false, length = 20)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "company", nullable = false, length = 100)
    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    @Basic
    @Column(name = "co_name", nullable = false, length = 100)
    public String getCoName() {
        return coName;
    }

    public void setCoName(String coName) {
        this.coName = coName;
    }

    @Basic
    @Column(name = "grade", nullable = false, length = 50)
    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    @Basic
    @Column(name = "awards", nullable = false, length = 50)
    public String getAwards() {
        return awards;
    }

    public void setAwards(String awards) {
        this.awards = awards;
    }

    @Basic
    @Column(name = "winning_time", nullable = false)
    public Date getWinningTime() {
        return winningTime;
    }

    public void setWinningTime(Date winningTime) {
        this.winningTime = winningTime;
    }

    @Basic
    @Column(name = "trend", nullable = false, length = -1)
    public String getTrend() {
        return trend;
    }

    public void setTrend(String trend) {
        this.trend = trend;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WinningEntity that = (WinningEntity) o;
        return wiId == that.wiId &&
                Objects.equals(name, that.name) &&
                Objects.equals(company, that.company) &&
                Objects.equals(coName, that.coName) &&
                Objects.equals(grade, that.grade) &&
                Objects.equals(awards, that.awards) &&
                Objects.equals(winningTime, that.winningTime) &&
                Objects.equals(trend, that.trend);
    }

    @Override
    public int hashCode() {
        return Objects.hash(wiId, name, company, coName, grade, awards, winningTime, trend);
    }
}
